package cn.gcBlock.po;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import java.io.Serializable;

/**
 * @author jie
 * @date 2019-08-22
 */
@Entity
@Data
@Table(name="block_currency" ,uniqueConstraints = {@UniqueConstraint(columnNames="symbol")})
public class BlockCurrency implements Serializable {

    // 名称
    @Id
    private int id;

    @Column(name = "name")
    private String name;

    // 符号
    @Column(name = "symbol")
    private String symbol;

    // 总量
    @Column(name = "coin",nullable = false)
    private Double coin;

    // 公开数据
    @Column(name = "data_block",columnDefinition="longtext")
    private String dataBlock;

    // 描述
    @Column(name = "description")
    private String description;

    // 公钥
    @Column(name = "public_key")
    private String publicKey;

    // 私钥
    @Column(name = "private_key")
    private String privateKey;

    public void copy(BlockCurrency source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}